#include "widget.h"
#include "ui_widget.h"
#include <QPushButton>
#include <QDebug>

Widget::Widget(QWidget *parent)
    : QWidget(parent)
    , ui(new Ui::Widget)
{
    ui->setupUi(this);

    //创建一个按钮，通过按钮来设置样式
    QPushButton* button = new QPushButton(this);
    button->setGeometry(0,0,100,100);
    button->setText("按钮");
    //给按钮设置样式
    button->setStyleSheet("QPushButton { border: 5px solid red; margin: 20px; }");
    //打印边界
    const QRect& rect = button->geometry();
    qDebug() << rect.x() << rect.y() << rect.width() << rect.height();
}

Widget::~Widget()
{
    delete ui;
}

